import { IsOptional, IsNumber, IsString, Min } from "class-validator";
import { Type } from "class-transformer";

/**
 * 角色查询参数DTO
 */
export class QueryRoleDto {
  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: "页码必须是数字" })
  @Min(1, { message: "页码必须从1开始" })
  page?: number;

  @IsOptional()
  @Type(() => Number)
  @IsNumber({}, { message: "每页数量必须是数字" })
  @Min(1, { message: "每页数量必须大于0" })
  pageSize?: number;

  @IsOptional()
  @IsString({ message: "角色名称搜索关键词必须是字符串" })
  name?: string;
}
